#include <memory>
#include <map>
#include <mutex>

class AbstractState;
class Host
{
public:
    Host();

    int update();
    void check_timeout();
    bool is_end();
private:
    std::shared_ptr<std::shared_ptr<AbstractState>> currentStatePtr;
};

class HostPool
{
public:
    void check_timeout();
    void clean();
    int size();

    std::shared_ptr<Host> instance(const std::string &id);

private:
    std::mutex mtx;
    std::map<std::string,std::shared_ptr<Host>> pool;
};

